<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是AliOSThings移植——移植说明的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV01-01-AliOSThings-17-代码移植-01-移植说明">
<meta property="og:url" content="https://sumumm.github.io/post/9edbdbbd.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是AliOSThings移植——移植说明的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029123649772.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029124236366.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20231210204640874.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029124611328.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20231210205407555.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20231210205632095.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029124838405.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029125210335.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029125404506.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029125734118.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029125911716.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029130026772.png">
<meta property="article:published_time" content="2023-12-11T15:10:27.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.023Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="LV21-天猫精灵IOT">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029123649772.png">


<link rel="canonical" href="https://sumumm.github.io/post/9edbdbbd.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://sumumm.github.io/post/9edbdbbd.html","path":"post/9edbdbbd.html","title":"LV01-01-AliOSThings-17-代码移植-01-移植说明"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV01-01-AliOSThings-17-代码移植-01-移植说明 | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E"><span class="nav-text">一、移植说明</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E8%B0%81%E5%9C%A8%E5%81%9A%E7%A7%BB%E6%A4%8D%E5%B7%A5%E4%BD%9C%EF%BC%9F"><span class="nav-text">1. 谁在做移植工作？</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%AE%98%E6%96%B9%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E"><span class="nav-text">2. 官方移植说明</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E7%A7%BB%E6%A4%8D%E7%9B%B8%E5%85%B3"><span class="nav-text">二、移植相关</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E6%96%B0%E5%A2%9ECPU%E6%9E%B6%E6%9E%84"><span class="nav-text">1. 新增CPU架构</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-%E5%B7%B2%E7%BB%8F%E6%94%AF%E6%8C%81%E7%9A%84CPU%E6%9E%B6%E6%9E%84"><span class="nav-text">1.1 已经支持的CPU架构</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-%E6%96%B0%E5%A2%9ECPU%E9%80%82%E9%85%8D%E7%82%B9"><span class="nav-text">1.2 新增CPU适配点</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3-CPU-arch%E7%9B%AE%E5%BD%95%E8%A7%84%E8%8C%83"><span class="nav-text">1.3 CPU arch目录规范</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-4-arch-mk%E6%96%87%E4%BB%B6%E7%BC%96%E5%86%99"><span class="nav-text">1.4 arch mk文件编写</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-5-config-in%E6%96%87%E4%BB%B6%E7%BC%96%E5%86%99"><span class="nav-text">1.5 config.in文件编写</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E6%96%B0%E5%A2%9Emcu"><span class="nav-text">2. 新增mcu</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-mcu%E7%9B%AE%E5%BD%95%E8%A7%84%E8%8C%83"><span class="nav-text">2.1 mcu目录规范</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-mcu-mk%E6%96%87%E4%BB%B6%E7%BC%96%E5%86%99"><span class="nav-text">2.2 mcu mk文件编写</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-%E5%85%B3%E8%81%94%E5%AF%B9%E5%BA%94CPU"><span class="nav-text">2.3 关联对应CPU</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-4-config-in%E6%96%87%E4%BB%B6%E7%BC%96%E5%86%99"><span class="nav-text">2.4 config.in文件编写</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E6%96%B0%E5%A2%9Eboard"><span class="nav-text">3. 新增board</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-board%E7%9B%AE%E5%BD%95%E8%A7%84%E8%8C%83"><span class="nav-text">3.1 board目录规范</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-board-mk%E6%96%87%E4%BB%B6%E7%BC%96%E5%86%99"><span class="nav-text">3.2 board mk文件编写</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-%E5%85%B3%E8%81%94%E5%AF%B9%E5%BA%94%E7%9A%84MCU"><span class="nav-text">3.3 关联对应的MCU</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4-config-in%E6%96%87%E4%BB%B6%E7%BC%96%E5%86%99"><span class="nav-text">3.4 config.in文件编写</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E6%96%B0%E5%A2%9Eexample"><span class="nav-text">4. 新增example</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/9edbdbbd.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV01-01-AliOSThings-17-代码移植-01-移植说明 | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV01-01-AliOSThings-17-代码移植-01-移植说明
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2023-12-11 23:10:27" itemprop="dateCreated datePublished" datetime="2023-12-11T23:10:27+08:00">2023-12-11</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/" itemprop="url" rel="index"><span itemprop="name">01HQ课程体系</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/" itemprop="url" rel="index"><span itemprop="name">LV21-天猫精灵IOT</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>5.2k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>19 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是AliOSThings移植——移植说明的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" width=150px>Windows版本</td>        <td align="left">windows11</td>    </tr>    <tr>        <td align="center">Ubuntu版本</td>        <td align="left">Ubuntu22.04的64位版本</td>      </tr>    <tr>        <td align="center">VMware® Workstation 16 Pro</td>        <td align="left">16.2.3 build-19376536</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="6">官方网站</td>        <td align="left"><a href="https://cn.aliyun.com/" target="_blank">阿里云</a></td>        <td align="left">阿里云官网主页</td>    </tr>    <tr>        <td align="left"><a href="https://www.aliyun.com/product/iot/livinglink?spm=5176.28508143.J_4VYgf18xNlTAyFFbOuOQe.317.5421154acZniIL&scm=20140722.X_data-1da961ea118f5bb0e4b2._.V_1" target="_blank">阿里生活物联平台</a></td>        <td align="left">生活物联网平台(飞燕平台)主页</td>    </tr>    <tr>        <td align="left"><a href="https://iap.aligenie.com/?spm=0.7629140.0.0.2c611780Ty6tzg" target="_blank">AliGenie</a></td>        <td align="left">天猫精灵开放平台AliGenie主页</td>    </tr>    <tr>        <td align="left"><a href="https://www.aliyun.com/product/iot/iot_instc_public_cn?spm=5176.28508143.J_4VYgf18xNlTAyFFbOuOQe.81.5421154au3ocqp&scm=20140722.X_data-9349178ba84cf028806a._.V_1" target="_blank">阿里物联网平台</a></td>        <td align="left">阿里物联网平台主页</td>    </tr>    <tr>        <td align="left"><a href="https://www.bluetooth.com/zh-cn/" target="_blank">Bluetooth 技术网站</a></td>        <td align="left">蓝牙协议规范什么的可以来这里找</td>    </tr>    <tr>        <td align="left"><a href="https://www.telink-semi.com/" target="_blank">Telink</a></td>        <td align="left">Telink | Chips for a Smarter IoT (telink-semi.com)<br><a href="https://www.telink-semi.cn/" target="_blank">Telink中文官网</a></td>    </tr>    <tr>        <td align="center" rowspan="5">开发手册</td>        <td align="left"><a href="https://help.aliyun.com/zh/alios-things/" target="_blank">AliOS Things开发指南</a></td>        <td align="left">AliOS Things开发指南，这里是最新版本，可以直接从官网找到</td>    </tr>     <tr>        <td align="left"><a href="https://haas.iot.aliyun.com/aliosthings/index.html" target="_blank">AliOS Things开发指南</a></td>        <td align="left">AliOS Things应用开发指南，这里应该是3.3版本的完整开发文档</td>    </tr>    <tr>        <td align="left"><a href="https://gaic.alicdn.com/aic/h5_daily/test/aliosthings/3.0.13/index.html" target="_blank">AliOS Things开发指南(3.0)</a></td>        <td align="left">AliOS Things应用开发指南，这里应该是3.0版本的完整开发文档</td>    </tr>    <tr>        <td align="left"><a href="https://help.aliyun.com/product/123207.html?spm=a2c4g.11186623.6.540.114e60d84sF58G" target="_blank">生活物联网平台开发文档</a></td>        <td align="left">生活物联网平台（飞燕平台）开发文档<br><a href="https://help.aliyun.com/document_detail/180778.html?spm=a2c4g.123207.0.0.49556adcO5apvd" target="_blank">《设备端开发指南》</a></td>    </tr>    <tr>        <td align="left"><a href="https://doc-bot.tmall.com/docs/doc.htm?spm=0.7629140.0.0.7bf81780UN7WkQ&treeId=578&articleId=118057&docType=1" target="_blank">Wi-Fi IoT品类定义与功能开发</a></td>        <td align="left">天猫精灵IoT开放平台——Wi-Fi IoT品类定义与功能开发</td>    </tr>    <tr>        <td align="center" rowspan="3">硬件平台</td>        <td align="left"><a href="https://developer.aliyun.com/article/761644?spm=a2c6h.12873581.0.dArticle761644.1c1b589dRHgvcR&groupCode=genieaiot" target="_blank">mk3080 WiFi开发板</a></td>        <td align="left">WiFi开发板使用指南-阿里云开发者社区</td>    </tr>    <tr>        <td align="left"><a href="http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/esp8266-nodemcu-tutorial-index/" target="_blank">esp8266开发板</a></td>        <td align="left">一个教程：ESP8266-NodeMCU开发板详解-太极创客 (taichi-maker.com)</td>    </tr>    <tr>        <td align="left"><a href="https://wiki.telink-semi.cn/doc/ds/DS_TLSR8258-E_Datasheet%20for%20Telink%20BLE+IEEE802.15.4%20Multi-Standard%20Wireless%20SoC%20TLSR8258.pdf" target="_blank">TLSR8258 Datasheet</a></td>        <td align="left">Datasheet for Telink BLE + IEEE802.15.4 MultiStandard Wireless SoC TLSR8258</td>    </tr>    <tr>        <td align="center" rowspan="2">参考资料</td>        <td align="left"><a href="https://developer.aliyun.com/article/720516#" target="_blank">AliOS Things 3.0 应用开发指南</a></td>        <td align="left">这个只是一篇参考文章，里面是一些环境搭建相关的，可以参考</td>    </tr>    <tr>        <td align="left"><a href="https://info.support.huawei.com/info-finder/encyclopedia/zh/index.html" target="_blank">IP知识百科 - 华为 (huawei.com)</a></td>        <td align="left">IP的一些相关知识点</td>    </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" width=150px>分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="left" rowspan="6">蓝牙规范相关文档</td>        <td align="left"><a href="https://www.bluetooth.com/zh-cn/specifications/specs/core-specification-5-2/" target="_blank">Core Specification 5.2</a></td>        <td align="left">核心规格 5.2，该规范定义了创建可互操作的Bluetooth 设备所需的技术。                        <br><a href="./蓝牙参考资料/Core_v5.2.pdf" target="_blank">《Core_v5.2.pdf》</a></td>      </tr>    <tr>        <td align="left"><a href="https://www.bluetooth.com/zh-cn/specifications/specs/mesh-model-1-1/" target="_blank">Mesh Model(v1.1)</a></td>        <td align="left">本Bluetooth 规范定义了模型（以及它们所需的状态和消息），这些模型用于在mesh 网络中的节点上执行基本功能，超出了Bluetooth Mesh 配置文件 规范中定义的基础模型。                        <br>本规范包括定义跨设备类型标准功能的通用模型，以及支持关键mesh 场景的模型，如照明控制、传感器、时间和场景。                        <br><a href="./蓝牙参考资料/MshMDL_v1.1.pdf" target="_blank">《MshMDL_v1.1.pdf》</a></td>      </tr>    <tr>        <td align="left"><a href="https://www.bluetooth.com/zh-cn/specifications/specs/mesh-profile-1-0-1/" target="_blank">Mesh Profile(v1.0.1)</a></td>        <td align="left">该Bluetooth 规范定义了基本要求，以实现可互操作的mesh 网络解决方案，用于Bluetooth 低能量无线技术。                        <br><a href="./蓝牙参考资料/MshPRFv1.0.1.pdf" target="_blank">《MshPRFv1.0.1.pdf》</a></td>      </tr>    <tr>        <td align="left"><a href="https://www.bluetooth.com/zh-cn/specifications/device-properties/" target="_blank">Mesh Device Properties</a></td>        <td align="left">本规范包含Bluetooth Mesh 配置文件 和Bluetooth Mesh 模型规范所要求的设备属性的定义。                        <br>但是跟之前的有些区别，我主要看的之前的版本：<a href="./蓝牙参考资料/MeshDeviceProperties_v1.2.pdf" target="_blank">《MMeshDeviceProperties_v1.2.pdf》</a></td>      </tr>    <tr>        <td align="left"><a href="https://www.bluetooth.com/specifications/gss/" target="_blank">GATT Specification Supplement</a></td>        <td align="left">GATT Specification Supplement | Bluetooth® Technology Website。                        <br>好像可以在线看：<a href="https://btprodspecificationrefs.blob.core.windows.net/gatt-specification-supplement/GATT_Specification_Supplement.pdf" target="_blank">《GATT Specification Supplement》</a></td>      </tr>     <tr>        <td align="left"><a href="https://www.bluetooth.com/specifications/assigned-numbers/" target="_blank">Assigned Numbers</a></td>        <td align="left">GATT的一些类型定义可以在这里找。</td>      </tr>    <tr>        <td align="left" rowspan="2">AliOS Things</td>        <td align="left"><a href="https://gitee.com/alios-things-admin/AliOS-Things" target="_blank">alios-things/AliOS-Things</a></td>        <td align="left">Gitee上的AliOSThings SDK源码仓库</td>      </tr>    <tr>        <td align="left"><a href="https://github.com/alibaba/AliOS-Things" target="_blank">alibaba/AliOS-Things</a></td>        <td align="left">GitHub上的AliOSThings SDK源码仓库</td>      </tr>    <tr>        <td align="left" rowspan="2">天猫精灵蓝牙Mesh协议栈</td>        <td align="left"><a href="https://github.com/alibaba-archive/genie-bt-mesh-stack" target="_blank">alibaba-archive/genie-bt-mesh-stack</a></td>        <td align="left">GitHub上的天猫精灵蓝牙Mesh协议栈源码仓库。<br>之前是在<a href="https://github.com/alibaba/genie-bt-mesh-stack"target="_blank">alibaba/genie-bt-mesh-stack</a>这个仓库。<br>写笔记的时候最新提交为<a href="https://github.com/alibaba-archive/genie-bt-mesh-stack/tree/faf523618a6a2560090fc423222b9db80984bb7a" target="_blank">faf523618a6a2560090fc423222b9db80984bb7a</a></td>      </tr>    <tr>        <td align="left"><a href="https://help.aliyun.com/document_detail/171552.html?spm=a2c4g.173310.0.0.55d6e992e8xJip" target="_blank">蓝牙Mesh设备开发指南</a></td>        <td align="left">阿里云生活服务平台开发手册——蓝牙设备开发一节中的内容</td>      </tr></table>
              </div>
            </details>

<h1 id="一、移植说明"><a href="#一、移植说明" class="headerlink" title="一、移植说明"></a><font size=3>一、移植说明</font></h1><h2 id="1-谁在做移植工作？"><a href="#1-谁在做移植工作？" class="headerlink" title="1. 谁在做移植工作？"></a><font size=3>1. 谁在做移植工作？</font></h2><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029123649772.png" alt="image-20201029123649772" />

<h2 id="2-官方移植说明"><a href="#2-官方移植说明" class="headerlink" title="2. 官方移植说明"></a><font size=3>2. 官方移植说明</font></h2><p>原来是有一个文档的，但是后来好像不维护，就直接没得了，那就大概了解一下好了。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029124236366.png" alt="image-20201029124236366" />

<h1 id="二、移植相关"><a href="#二、移植相关" class="headerlink" title="二、移植相关"></a><font size=3>二、移植相关</font></h1><h2 id="1-新增CPU架构"><a href="#1-新增CPU架构" class="headerlink" title="1. 新增CPU架构"></a><font size=3>1. 新增CPU架构</font></h2><p>首先是要新增CPU的架构代码，涉及的目录为 AOS_SDK_PATH&#x2F;platform&#x2F;arch 目录。但是AliOSThings原本就支持了很多的CPU架构，这就看情况需不需要添加了。</p>
<h3 id="1-1-已经支持的CPU架构"><a href="#1-1-已经支持的CPU架构" class="headerlink" title="1.1 已经支持的CPU架构"></a><font size=3>1.1 已经支持的CPU架构</font></h3><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20231210204640874.png" alt="image-20231210204640874"  />

<p>其实我们可以直接去源码的AOS_SDK_PATH&#x2F;platform&#x2F;arch目录下，一样可以看到目前支持哪些CPU架构：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line">hk@vm:~/AliOS-Things-SDK/platform/arch$ tree -L 2</span><br><span class="line">.</span><br><span class="line">├── arm</span><br><span class="line">│   ├── armv5</span><br><span class="line">│   ├── armv6m</span><br><span class="line">│   ├── armv6m-mk</span><br><span class="line">│   ├── armv7a</span><br><span class="line">│   ├── armv7a-mk</span><br><span class="line">│   ├── armv7m</span><br><span class="line">│   └── armv7m-mk</span><br><span class="line">├── csky</span><br><span class="line">│   └── cskyv2-l</span><br><span class="line">├── linux</span><br><span class="line">│   ├── aos.mk</span><br><span class="line">│   ├── Config.in</span><br><span class="line">│   ├── cpu_impl.c</span><br><span class="line">│   ├── include</span><br><span class="line">│   ├── README.md</span><br><span class="line">│   ├── swap.h</span><br><span class="line">│   └── swap.S</span><br><span class="line">├── mips</span><br><span class="line">│   ├── mips32</span><br><span class="line">│   └── mips-I</span><br><span class="line">├── README.md</span><br><span class="line">├── risc-v</span><br><span class="line">│   └── risc_v32I</span><br><span class="line">├── rx600</span><br><span class="line">│   └── rx65n</span><br><span class="line">└── xtensa</span><br><span class="line">    ├── lx106</span><br><span class="line">    └── lx6</span><br><span class="line"></span><br><span class="line">22 directories, 7 files</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="1-2-新增CPU适配点"><a href="#1-2-新增CPU适配点" class="headerlink" title="1.2 新增CPU适配点"></a><font size=3>1.2 新增CPU适配点</font></h3><p>对于系统中已经支持的CPU架构，可以直接使用对应的 platform&#x2F;arch 模块，如果需要新增CPU架构支持，需要适配下面的接口，其对所有的CPU架构通用：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029124611328.png" alt="image-20201029124611328" />

<p>这里的接口实际会在port_c.c或者port_s.S中实现，其他CPU架构相关的文件需要放在arch目录下，也可以按照实际需要放。</p>
<h3 id="1-3-CPU-arch目录规范"><a href="#1-3-CPU-arch目录规范" class="headerlink" title="1.3 CPU arch目录规范"></a><font size=3>1.3 CPU arch目录规范</font></h3><p>这里是从之前的官方文档截取的一部分，这里大概了解一下，其实也可以直接去读源码就可以的：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20231210205407555.png" alt="image-20231210205407555" />

<p>三级和四级目录说明如下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20231210205632095.png" alt="image-20231210205632095" />

<h3 id="1-4-arch-mk文件编写"><a href="#1-4-arch-mk文件编写" class="headerlink" title="1.4 arch mk文件编写"></a><font size=3>1.4 arch mk文件编写</font></h3><p>规范：没有例外情况，统一在二级Process arch目录添加对应的编译mk文件。arch mk添加规范如下(以armv7m为例):</p>
<figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">NAME := arch_armv7m                   <span class="comment">#arch_+架构名</span></span><br><span class="line"><span class="variable">$(NAME)</span>_MBINS_TYPE := kernel          <span class="comment">#多bin情况下，归属kernel还是app</span></span><br><span class="line"><span class="variable">$(NAME)</span>_VERSION    :=1.0.2            <span class="comment">#menuconfig版本号</span></span><br><span class="line"><span class="variable">$(NAME)</span>_SUMMARY    := arch for armv7m <span class="comment">#描述</span></span><br><span class="line"><span class="variable">$(NAME)</span>_SOURCES    +=                 <span class="comment">#组件包含.c文件</span></span><br><span class="line">GLOBAL_INCLUDES    +=                 <span class="comment">#包含头文件</span></span><br><span class="line"><span class="keyword">ifeq</span> (<span class="variable">$(COMPILER)</span> , armcc)            <span class="comment">#区分编译器</span></span><br><span class="line"><span class="keyword">ifeq</span> (<span class="variable">$(HOST_ARCH)</span> , Cortex-M4)       <span class="comment">#区分Processseries</span></span><br></pre></td></tr></table></figure>

<h3 id="1-5-config-in文件编写"><a href="#1-5-config-in文件编写" class="headerlink" title="1.5 config.in文件编写"></a><font size=3>1.5 config.in文件编写</font></h3><p>arch Config.in添加规范如下(以armv7m为例)：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">config AOS_ARCH_ARMV7M           #定义组件配置选项</span><br><span class="line">	bool                         #配置选项类型</span><br><span class="line">	help</span><br><span class="line">		arch for armv7m          #配置选项帮助</span><br><span class="line">if AOS_ARCH_ARMV7M</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">Configurations <span class="keyword">for</span> <span class="built_in">arch</span> armv7m <span class="comment">#如有必要，定义更多组件内配置选项</span></span></span><br><span class="line">endif</span><br></pre></td></tr></table></figure>

<p>Arch组件配置选项命名规范：使用前缀“AOS_ARCH_”+组件NAME。原则上在3.1版本中，mk只用来增加定义的组件components，其他配置和宏定义统一在Config.in定义。</p>
<h2 id="2-新增mcu"><a href="#2-新增mcu" class="headerlink" title="2. 新增mcu"></a><font size=3>2. 新增mcu</font></h2><p>涉及目录:  AOS_SDK_PATH&#x2F;platform&#x2F;mcu。mcu目录存放其原始SDK驱动文件（厂商原有的软件包），以及hal驱动对接层（aos hal层适配的代码）。外设驱动以及用户对于单板的配置代码不放入此目录，以便该SDK能支持该MCU下所有系列单板。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029124838405.png" alt="image-20201029124838405" />

<h3 id="2-1-mcu目录规范"><a href="#2-1-mcu目录规范" class="headerlink" title="2.1 mcu目录规范"></a><font size=3>2.1 mcu目录规范</font></h3><p>主要目录结构：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">Dir\File           Description                           Necessary for kernel run</span><br><span class="line">|-- drivers   # board peripheral driver,或者是BSP                    Y</span><br><span class="line">|-- hal       # hal API layer,hal uart is necessary                 Y</span><br><span class="line">|-- aos.mk    # mcu makefile                                        Y</span><br><span class="line">|-- Config.in # menuconfig component config                         Y</span><br><span class="line">|-- ucube.py  # aos build system file(for scons)                    N</span><br><span class="line">|--README.md                                                        Y</span><br></pre></td></tr></table></figure>

<p>例如 platform&#x2F;mcu&#x2F;esp8266 目录：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029125210335.png" alt="image-20201029125210335" />

<h3 id="2-2-mcu-mk文件编写"><a href="#2-2-mcu-mk文件编写" class="headerlink" title="2.2 mcu mk文件编写"></a><font size=3>2.2 mcu mk文件编写</font></h3><p>mcu的mk文件，其描述了当前mcu组件需要的编译文件和编译选项。如果该系列MCU能实现一个通用mk文件则使用一个即可；如果该MCU体系下存在多种MCU子系列，那么需要添加子mcu的mk文件，在其中放置不同的属性定义。aos.mk作为主mk，主要放置公共的属性配置，并使用HOST_MCU_NAME来分别引用对应的子mcu。不同的mcu子系列主要是由于其链接的驱动文件或者编译选项等不同，需要通过不同的mk来区分实现。示例如下：</p>
<figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">aamcu_demo             <span class="comment"># mcu主目录</span></span><br><span class="line">	|-- aos.mk         <span class="comment"># 该mcu主mk</span></span><br><span class="line">	|-- aamcu1_demo.mk <span class="comment"># aamcu1_demo</span></span><br><span class="line">	|-- aamcu2_demo.mk <span class="comment"># aamcu2_demo</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>在对应board如aaboard_demo的aos.mk文件引用此mcu模块名时，使用格式如下：</p>
<figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">HOST_MCU_FAMILY := mcu_aamcu_demo</span><br><span class="line">HOST_MCU_NAME   := aamcu1_demo</span><br></pre></td></tr></table></figure>

<p>在mcu的主aos.mk中需要分别对子mcu进行引用，使用格式：</p>
<figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">include</span> $(<span class="variable">$(NAME)</span>_LOCATION)/<span class="variable">$(HOST_MCU_NAME)</span>. mk</span><br></pre></td></tr></table></figure>

<p>aos.mk其他必须包含项：</p>
<figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">NAMET:= mcu_aamcu_demo                   <span class="comment">#主MCU名，一般是mcu_+当前mcu目录名</span></span><br><span class="line"><span class="variable">$(NAME)</span>_MBINS_TYPE := kernel             <span class="comment">#多bin情况下，归属kernel还是app</span></span><br><span class="line"><span class="variable">$(NAME)</span>_VERSION    :=1.0.2               <span class="comment">#menuconfig组件版本号</span></span><br><span class="line"><span class="variable">$(NAME)</span>_SUMMARY    := driver &amp; sdk       <span class="comment">#描述</span></span><br><span class="line"><span class="variable">$(NAME)</span>_SOURCES    +=                    <span class="comment">#MCU组件包含.c文件</span></span><br><span class="line"><span class="variable">$(NAME)</span>_COMPONENTS +=                    <span class="comment">#依赖其他组件名</span></span><br><span class="line">GLOBAL_INCLUDES    +=                    <span class="comment">#头文件</span></span><br><span class="line">GLOBAL_CFLAGS      +=                    <span class="comment">#c文件编译选项</span></span><br><span class="line">GLOBAL_ASMFLAGS    +=                    <span class="comment">#汇编编译选项</span></span><br><span class="line">GLOBAL_LDFLAGS     +=                    <span class="comment">#链接选项</span></span><br><span class="line">GLOBAL_DEFINES     +=                    <span class="comment">#用户自定义宏</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="2-3-关联对应CPU"><a href="#2-3-关联对应CPU" class="headerlink" title="2.3 关联对应CPU"></a><font size=3>2.3 关联对应CPU</font></h3><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029125404506.png" alt="image-20201029125404506" />

<h3 id="2-4-config-in文件编写"><a href="#2-4-config-in文件编写" class="headerlink" title="2.4 config.in文件编写"></a><font size=3>2.4 config.in文件编写</font></h3><p>mcu Config.in添加规范如下(以aamcu_demo为例)：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">config AOS_MCU_AAMCU_DEMO          #定义组件配置选项</span><br><span class="line">	bool                           #配置选项类型</span><br><span class="line">	select AOS_ARCH_ARMV7M         #依赖特定arch</span><br><span class="line">	select ...                     #依赖其他组件</span><br><span class="line">	help</span><br><span class="line">		driver &amp; sdk for platform/mcu aamcu_demo #配置选项帮助</span><br><span class="line">if AOS_MCU_AAMCU_DEMO</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">Configurations <span class="keyword">for</span> mcu aamcu_demo <span class="comment">#如有必要，定义更多组件内配置选项</span></span></span><br><span class="line">endif</span><br></pre></td></tr></table></figure>

<p>mcu组件配置选项命名规范:使用前缀“AOS_MCU_”+组件NAME。同样，原则上在3.1版本中，mk只用来增加定义的组件components，其他配置和宏定义统一在Config.in定义。</p>
<h2 id="3-新增board"><a href="#3-新增board" class="headerlink" title="3. 新增board"></a><font size=3>3. 新增board</font></h2><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029125734118.png" alt="image-20201029125734118" />

<p>我们来看一下 platform&#x2F;board&#x2F;esp8266目录：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029125911716.png" alt="image-20201029125911716" />

<p>我们来 platform&#x2F;board&#x2F;esp8266&#x2F;drivers 目录看一下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-17-%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D-01-%E7%A7%BB%E6%A4%8D%E8%AF%B4%E6%98%8E/img/image-20201029130026772.png" alt="image-20201029130026772" />



<h3 id="3-1-board目录规范"><a href="#3-1-board目录规范" class="headerlink" title="3.1 board目录规范"></a><font size=3>3.1 board目录规范</font></h3><p>board取名需要使用官方通用名，能方便检索到相关信息。board目录下文件结构部署和命名需要遵循下面布局规则，以aaboard_demo单板为例：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">Dir\File                        Description                                          Necessary for kernel run</span><br><span class="line">|-- drivers            # board peripheral driver                                               N</span><br><span class="line">|-- config</span><br><span class="line">|	|-- board.h        # board config file,define for user,such as uart port num               Y</span><br><span class="line">|	|-- k_config. c    # user&#x27;s kernel hook and mm memory region define                        Y</span><br><span class="line">|	|-- k_config.h     # kernel config file .h                                                 Y</span><br><span class="line">|	|-- partition_conf. c # board flash config file                                            N</span><br><span class="line">|-- startup</span><br><span class="line">|	|-- board. c       # board_init implement                                                  Y</span><br><span class="line">|	|-- startup. c     # main entry file                                                       Y</span><br><span class="line">|	|-- startup_gcc.s  # board startup assember for gcc                                        Y</span><br><span class="line">|	|-- startup_iar.s  # board startup assember for iar                                        Y</span><br><span class="line">|	|-- startup_keil.s # board startup assember for keil                                       Y</span><br><span class="line">|-- aaboard_demo.icf   # linkscript file for iar                                               Y</span><br><span class="line">|-- aaboard_demo.ld    # linkscript file for gcc                                               Y</span><br><span class="line">|-- aaboard_demo.sct   # linkscript file for sct                                               Y</span><br><span class="line">|-- aos.mk             # board makefile                                                        Y</span><br><span class="line">|-- Config.in          # menuconfig component config                                           Y</span><br><span class="line">|-- ucube. py          # aos build system file(for scons)                                      N</span><br><span class="line">|-- README.md          #                                                                       Y</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>board相关初始化使用的函数名需规范统一，参照如下：                 </p>
<table>
<thead>
<tr>
<th>文件</th>
<th>函数名</th>
</tr>
</thead>
<tbody><tr>
<td>k_config.c</td>
<td>实现样例单板aaboard demo该文件内所有对接接口</td>
</tr>
<tr>
<td>partition_conf.c</td>
<td>统一分区初始化接口: flash_partition_init</td>
</tr>
<tr>
<td>board.c</td>
<td>统一单板初始化接口: board_init</td>
</tr>
<tr>
<td>startup.c</td>
<td>无特殊情况统一C程序主入口为main;内部调用单板初始化board_init;内部调用krhino接口初始化内核;内部创建主任务入口sys_init</td>
</tr>
</tbody></table>
<h3 id="3-2-board-mk文件编写"><a href="#3-2-board-mk文件编写" class="headerlink" title="3.2 board mk文件编写"></a><font size=3>3.2 board mk文件编写</font></h3><p>如下是一些关键点：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">NAME := board_aaboard_demo                #board_+单板名</span><br><span class="line"><span class="meta prompt_">$</span><span class="language-bash">(NAME)_MBINS_TYPE := kernel              <span class="comment">#在多bin情况下，归属kernel还是app</span></span></span><br><span class="line"><span class="meta prompt_">$</span><span class="language-bash">(NAME)_VERSION    := 1.0.1               <span class="comment">#组件版本号</span></span></span><br><span class="line"><span class="meta prompt_">$</span><span class="language-bash">(NAME)_SUMMARY    :=                     <span class="comment">#描述</span></span></span><br><span class="line">MODULE             := 1062                #固定</span><br><span class="line">HOST_ARCH          := Cortex-M4           #CPU arch</span><br><span class="line">HOST_MCU_FAMILY    := mcu_aamcu_demo      #归属MCU系列，需要对应platform/mcu下aos.mk组件</span><br><span class="line">SUPPORT_MBINS      :=no                   #是否支持app\kernel的bin分离</span><br><span class="line">HOST_MCU_NAME      := aamcul_demo         #MCU子系列类型</span><br><span class="line">ENABLE_VFP         := 1                   #是否支持浮点数</span><br><span class="line"><span class="meta prompt_">$</span><span class="language-bash">(NAME)_SOURCES    +=                     <span class="comment">#board组件包含.c文件</span></span></span><br><span class="line"><span class="meta prompt_">$</span><span class="language-bash">(NAME)_COMPONENTS +=                     <span class="comment">#依赖其他组件名</span></span></span><br><span class="line">GLOBAL_INCLUDES    +=                     #头文件</span><br><span class="line">GLOBAL_CFLAGS      +=                     #c文件编译选项</span><br><span class="line">GLOBAL_ASMFLAGS    +=                     #汇编编译选项</span><br><span class="line">GLOBAL_LDFLAGS     +=                     #链接选项</span><br><span class="line">GLOBAL_DEFINES     +=                     #用户自定义宏</span><br></pre></td></tr></table></figure>

<p>注意:<br>(1)、其中HOST_MCU_FAMILY的定义需要对应platform&#x2F;mcu某子目录下aos.mk中的组件名NAME，一般是mcu_+“mcu名”。</p>
<p>(2)、用户可以通过GLOBAL_DEFINES定义宏，如GLOBAL_DEFINES +&#x3D; CONFIG_AOS_CLI_BOARD。</p>
<p>(3)、原则上在3.1版本中，mk只用来增加定义的组件components，其他配置和宏定义统一在Config. in定义。</p>
<h3 id="3-3-关联对应的MCU"><a href="#3-3-关联对应的MCU" class="headerlink" title="3.3 关联对应的MCU"></a><font size=3>3.3 关联对应的MCU</font></h3><p>每个board需要关联其从属的MCU，通过在其mk中添加HOST_MCU_FAMILY定义来指定。同时，如果存在子MCU，则还需要设置具体的HOST_MCU_NAME。例如对于aaboard_demo单板，其要关联MCU是aamcu_demo系列下的aamcu1_demo，在aaboard_demo目录下的aos.mk设置如下:</p>
<figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">HOST_MCU_FAMILY := mcu_aamcu_demo</span><br><span class="line">HOST_MCU_NAME   := aamcul_demo</span><br></pre></td></tr></table></figure>

<h3 id="3-4-config-in文件编写"><a href="#3-4-config-in文件编写" class="headerlink" title="3.4 config.in文件编写"></a><font size=3>3.4 config.in文件编写</font></h3><p>board Config.in添加规范如下(以aaboard_demo为例)：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">config AOS_BOARD_AABOARD_DEMO                #定义组件配置选项</span><br><span class="line">	bool &quot;AABOARD_DEMO&quot;                      #配置选项类型，双引号定义该选项显示名称</span><br><span class="line">	select AOS_MCU_AAMCU_DEMO                #依赖特定mcu</span><br><span class="line">	select ...                               #依赖其他组件</span><br><span class="line">	help                                    </span><br><span class="line">    	...                                  #配置选项帮助</span><br><span class="line">	</span><br><span class="line">if AOS_BOARD_AABOARD_DEMO</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">Configurations <span class="keyword">for</span> board aaboard_demo</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&quot;BSP SUPPORT FEATURE&quot;</span>                       <span class="comment">#硬件支持的能力</span></span></span><br><span class="line">config BSP_SUPPORT_UART</span><br><span class="line">	bool</span><br><span class="line">	default y</span><br><span class="line">	...</span><br><span class="line">endif</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>board组件配置选项命名规范：使用前缀“AOS_BOARD_”＋组件NAME</p>
<h2 id="4-新增example"><a href="#4-新增example" class="headerlink" title="4. 新增example"></a><font size=3>4. 新增example</font></h2><p>涉及目录: applexample</p>
<p>example目录主要存放用户实际需要运行的程序，包括主任务入口aos_maintask，以及用户app统一入口application_start。原则上不建议新增example，除非目前的example不能满足功能需求。app&#x2F;example下为通用运行实例，如果新增example，需要具有通用性,而不是为了某个特殊，或者临时性的修改。</p>
<p>其中app&#x2F;example&#x2F;example_legacy下为3.1版本之前规范的app示例，其不包括maintask.c主任务实现，其相关主任务的板级实现统一在跳转app前做全初始化，即不同的app，底层初始化的模块是一样的;</p>
<p>app&#x2F;example目录非example_legacy下为3.1版本要求的规范app示例，其包括maintask.c主任务实现，对板级初始化做了模块区分，以期望实现不同app按照具体需求来初始化不同的board模块。</p>
<p>其中，app&#x2F;example&#x2F;example_legacy对应platform&#x2F;board&#x2F;board_legacy目录的单板;其他app&#x2F;example对应platform&#x2F;board下非board_legacy实现。</p>
<p>另，platform&#x2F;board&#x2F;board_legacy原有单板只能支持老的example_legacy实现；新的platform&#x2F;board单板，兼容app&#x2F;example所有app。</p>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/9edbdbbd.html">LV01-01-AliOSThings-17-代码移植-01-移植说明</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2023年12月11日 - 23:10</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/9edbdbbd.html" title="LV01-01-AliOSThings-17-代码移植-01-移植说明">https://sumumm.github.io/post/9edbdbbd.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/" rel="tag"><i class="fa fa-tag"></i> LV21-天猫精灵IOT</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/61947ddd.html" rel="prev" title="LV01-01-AliOSThings-17-代码移植-02-代码适配">
                  <i class="fa fa-angle-left"></i> LV01-01-AliOSThings-17-代码移植-02-代码适配
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/9f33f8fd.html" rel="next" title="LV01-01-AliOSThings-16-事件驱动-02-事件驱动的使用方法">
                  LV01-01-AliOSThings-16-事件驱动-02-事件驱动的使用方法 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
